<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>添加题库</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="__PUBLIC__/BeginnerAdmin/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="__PUBLIC__/BeginnerAdmin/plugins/font-awesome/css/font-awesome.min.css">
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>添加教职工</legend>
</fieldset>
<form class="layui-form layui-form-pane" action="" style="width: 90%">


    <input type="hidden" name="uid" lay-verify="uid" value="<{$info.uid}>">
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="name" autocomplete="off" placeholder="请输入姓名" class="layui-input" value="<{$info.name}>">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机</label>
        <div class="layui-input-block">
            <input type="text" name="mobile" lay-verify="mobile" autocomplete="off" placeholder="输入手机号" class="layui-input" value="<{$info.mobile}>">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            <select name="group" lay-verify="group">
                <option value=""></option>
                <option value="1"<if condition="($info.group eq 1)"> selected</if>>管理员</option>
                <option value="2"<if condition="($info.group eq 2)"> selected</if>>教师</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="__PUBLIC__/BeginnerAdmin/plugins/layui/layui.js"></script>
<script type="text/javascript" src="__PUBLIC__/AmazeUI/assets/js/jquery-1.8.0.min.js"></script>
<script>
    function settime() {
        // window.location.href = 'Admin_Topic_NewTopicUI.html?examinationid=<{$examinationid}>';
        var index=parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
    layui.use(['form', 'laydate'], function() {
        var form = layui.form,
            layer = layui.layer,
            laydate = layui.laydate;

        //自定义验证规则
        form.verify({
            title: function(value) {
                if(value.length < 4) {
                    return '标题至少得4个字符啊';
                }
            }
        });

        //监听提交
        form.on('submit(demo1)', function(data) {

            $.post('Admin_Teacher_UpdataTeacher.html',data.field,function (ret) {
                if(ret.code == 200){
                    layer.msg('修改成功');
                    setTimeout('settime()', 1500);//延时执行，让人看得更清楚
                }else{
                    layer.alert(ret.msg);
                }
            },'json');
            return false;
        });
    });
</script>
</body>
</html>